package com.czh.gzskzn.shenke3.Activity;

import android.graphics.Color;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.webkit.WebView;
import android.webkit.WebViewClient;

import com.czh.gzskzn.shenke3.R;
import com.czh.gzskzn.shenke3.ShoYeFrag;

public class NewActivity extends AppCompatActivity {

    private WebView wanYe;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_new);

        wanYe = (WebView) findViewById(R.id.new_wv_wang);
        WanYe();

    }

    private void WanYe() {
        //设置WebView属性，能够执行Javascript脚本
        wanYe.getSettings().setJavaScriptEnabled(false);
        //加载需要显示的网页
        wanYe.loadUrl("http://news.qq.com/");
        //设置Web视图
        wanYe.setWebViewClient(new NewActivity.HelloWebViewClient());
        wanYe.getSettings().setUseWideViewPort(true);
        wanYe.getSettings().setLoadWithOverviewMode(true);
//        wanYe.setBackgroundColor(Color.parseColor("#000000"));
        wanYe.getSettings().setDefaultFontSize(5);
    }

    //Web视图
    private class HelloWebViewClient extends WebViewClient {
        @Override
        public boolean shouldOverrideUrlLoading(WebView view, String url) {
            view.loadUrl(url);
            return false;
        }
    }

}
